home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: elesueur@ens-lyon.fr (Emmanuel Lesueur)
- Newsgroups: comp.std.c++
- Subject: Re: Static member functions and overloading resolution
- Date: 18 Mar 1996 20:34:56 GMT
- Organization: Ecole Normale Superieure de Lyon, France
- Approved: clamage@eng.sun.com (comp.std.c++)
- Distribution: world
- Message-ID: <4ikb60$4i@cri.ens-lyon.fr>
- References: <4ifv63$qsk@engnews1.Eng.Sun.COM>
- Reply-To: elesueur@ens-lyon.fr
- NNTP-Posting-Host: taumet.eng.sun.com
- X-Nntp-Posting-Host: neron.ens-lyon.fr
- Content-Length: 932
- X-Lines: 33
- Originator: clamage@taumet
-
- In article <4ifv63$qsk@engnews1.Eng.Sun.COM>, clamage@Eng.Sun.COM (Steve Clamage) writes:
- >According to the way you wrote your example, the first
- >candidate is the non-static f(int). It requires a conversion
- >from B& to A& on the first argument, and a promotion of char
- >to int on the second. The second candidate, static f(char), has
- >an exact match on any first argument (since it is a fiction anyway),
- >and an exact match (char to char) on the second argument.
- >There is no ambiguity, and the static f(char) should be selected.
-
- Oops... You're right, of course. I swapped the function parameters.
- What about:
-
- > class A {
- > public:
- > void f(char);
- > static void f(int);
- > };
-
- > class B : public A {
- > };
-
- > void foo(B& b,char c) {
- > b.f(c);
- > }
-
- Is this ambiguous ? As I understand it, the draft paper says yes.
- (gcc says no.)
-
- ___________________________________________________
-
- Emmanuel Lesueur - elesueur@ens-lyon.fr
-
-
-
-
- [ comp.std.c++ is moderated. To submit articles: Try just posting with your
- newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
- comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
- Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
- Comments? mailto:std-c++-request@ncar.ucar.edu
- ]
-